package org.omg.GIOP;

//
// Helper class for : ReplyHeader_1_0
//
// @author OpenORB Compiler
//
public class ReplyHeader_1_0Helper
{

	//
	// Insert ReplyHeader_1_0 into an any
	// @param	a an any
	// @param	t ReplyHeader_1_0 value
	//
	public static void insert( org.omg.CORBA.Any a, org.omg.GIOP.ReplyHeader_1_0 t )
	{
		a.insert_Streamable( new org.omg.GIOP.ReplyHeader_1_0Holder( t ));
	}

	//
	// Extract ReplyHeader_1_0 from an any
	// @param	a an any
	// @return the extracted ReplyHeader_1_0 value
	//
	public static org.omg.GIOP.ReplyHeader_1_0 extract( org.omg.CORBA.Any a )
	{

		return read(a.create_input_stream());
	}

	//
	// Internal TypeCode value
	//
	private static org.omg.CORBA.TypeCode _tc = null;
	private static boolean _working = false;

	//
	// Return the ReplyHeader_1_0 TypeCode
	// @return a TypeCode
	//
	public static org.omg.CORBA.TypeCode type()
	{
		if ( _tc == null ) {
			synchronized(org.omg.CORBA.TypeCode.class) {
				if ( _tc != null )
					return _tc;
				if ( _working )
					return org.omg.CORBA.ORB.init().create_recursive_tc( id() );
				_working = true;
				org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init();
				org.omg.CORBA.StructMember []_members = new org.omg.CORBA.StructMember[3];

				_members[0] = new org.omg.CORBA.StructMember();
				_members[0].name = "service_context";
				_members[0].type = org.omg.IOP.ServiceContextListHelper.type();
				_members[1] = new org.omg.CORBA.StructMember();
				_members[1].name = "request_id";
				_members[1].type = orb.get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong);
				_members[2] = new org.omg.CORBA.StructMember();
				_members[2].name = "reply_status";
				_members[2].type = org.omg.GIOP.ReplyStatusType_1_0Helper.type();
				_tc = orb.create_struct_tc(id(),"ReplyHeader_1_0",_members);
				_working = false;
			}
		}
		return _tc;
	}

	//
	// Return the ReplyHeader_1_0 IDL ID
	// @return an ID
	//
	public static String id()
	{
		return _id;
	}

	private final static String _id = "IDL:omg.org/GIOP/ReplyHeader_1_0:1.0";

	//
	// Read ReplyHeader_1_0 from a marshalled stream
	// @param	istream the input stream
	// @return the readed ReplyHeader_1_0 value
	//
	public static org.omg.GIOP.ReplyHeader_1_0 read( org.omg.CORBA.portable.InputStream istream )
	{
		org.omg.GIOP.ReplyHeader_1_0 new_one = new org.omg.GIOP.ReplyHeader_1_0();

		new_one.service_context = org.omg.IOP.ServiceContextListHelper.read(istream);
		new_one.request_id = istream.read_ulong();
		new_one.reply_status = org.omg.GIOP.ReplyStatusType_1_0Helper.read(istream);

		return new_one;
	}

	//
	// Write ReplyHeader_1_0 into a marshalled stream
	// @param	ostream the output stream
	// @param	value ReplyHeader_1_0 value
	//
	public static void write( org.omg.CORBA.portable.OutputStream ostream, org.omg.GIOP.ReplyHeader_1_0 value )
	{
		org.omg.IOP.ServiceContextListHelper.write(ostream,value.service_context);
		ostream.write_ulong(value.request_id);
		org.omg.GIOP.ReplyStatusType_1_0Helper.write(ostream,value.reply_status);
	}

}
